<?php
require_once '../application/library/db/gcDaoFactory.php';
require_once '../application/constant/daoConfig.php';

/**
* 商品详细画面用的Service
* 商品管理
* @version   0.1
* @author    Suda
*/
class goods_services_goodsFormulaDetailsService {
    private $objDaoFactory;

    public function __construct() {
        $this->objDaoFactory = gcDaoFactory::getInstance();
    }

    public function pbGetFormulaItemInfoAndStockNum($strFormulaNo) {
        $objFormulaItemDao = $this->objDaoFactory->createDao(daoConfig::T_EC_M_FORMULA_ITEM_DAO);
        $arrFormulaItemInfo = $objFormulaItemDao->pbGetFormulaItemInfoAndStockNum($strFormulaNo);
        return $arrFormulaItemInfo;
    }

    public function pbGetFormulaInfo($strFormulaNo) {
        $objFormulaDao = $this->objDaoFactory->createDao(daoConfig::T_EC_M_FORMULA_DAO);
        $arrFormulaInfo = $objFormulaDao->pbGetFormulaInfo($strFormulaNo);
        return $arrFormulaInfo;
    }

    public function pbUpdateProductNum($strProductGoodsNo,$strManufacturingNum) {
        $objGoodsDao = $this->objDaoFactory->createDao(daoConfig::T_EC_M_GOODS_DAO);
        $intUpdateRe = $objGoodsDao->pbUpdateProductNum($strProductGoodsNo,$strManufacturingNum);
    }

    public function pbUpdateGoodsNum($arrNeedNum,$arrGoodsNo) {
        $objGoodsDao = $this->objDaoFactory->createDao(daoConfig::T_EC_M_GOODS_DAO);
//        var_dump($arrNeedNum,$arrGoodsNo);
        foreach($arrNeedNum as $key => $value) {
            $objGoodsDao->pbUpdateGoodsNum($arrGoodsNo[$key],$arrNeedNum[$key]);
        }
    }

}